import store from "@/store"

export default  function (){
    let Light  = {
        '--van-black': '#000',
        '--van-white': '#fff',
        '--van-gray-1':'#f7f8fa',
        '--van-gray-2':'#f2f3f5',
        '--van-gray-3':'#ebedf0',
        '--van-gray-4':'#dcdee0',
        '--van-gray-5':'#c8c9cc',
        '--van-gray-6':'#969799',
        '--van-gray-7':'#646566',
        '--van-gray-8':'#323233',
        "--van-red" : '#ee0a24',
        "--van-blue": '#1989fa',
        "--van-orange": '#ff976a',
        "--van-orange-dark": '#ed6a0c',
        "--van-orange-light":' #fffbe8',
        "--van-green": '#07c160',
        "--main-color" :'#f7f8fa',
        "--search-bgColor":'#fff',
        "--contac-card-bg":'#fff'
    }
    let dark = {
        '--van-black': '#fff',
        '--van-white': '#222',
        '--van-gray-1':'#f7f8fa',
        '--van-gray-2':'#f2f3f5',
        '--van-gray-3':'#ebedf0',
        '--van-gray-4':'#dcdee0',
        '--van-gray-5':'#c8c9cc',
        '--van-gray-6':'#969799',
        '--van-gray-7':'#646566',
        '--van-gray-8':'#b1b1b7',
        "--van-red" : '#ee0a24',
        "--van-blue": '#1989fa',
        "--van-orange": '#ff976a',
        "--van-orange-dark": '#ed6a0c',
        "--van-orange-light":' #fffbe8',
        "--van-green": '#07c160',
        "--main-color" :'#222',
        "--search-bgColor":'#646566',
        "--contac-card-bg":'#2b2b2c'
    }
    
    if(store.state.theme === 'light'){
        Object.keys(dark).forEach(key => {
            document.documentElement.style.setProperty(key, dark[key])
        })
        // document.documentElement.style.setProperty("--main-color", "#222")
        // document.documentElement.style.setProperty("--van-white", "#222")
        // document.documentElement.style.setProperty("--van-gray-8", "#fff")
    }else{
        // document.documentElement.style.setProperty("--main-color", "#f7f8fa")
        Object.keys(Light).forEach(key => {
            document.documentElement.style.setProperty(key, Light[key])
        })
    }
    store.commit('setTheme')
}
